package com.example.service_cms.controller;


import com.example.commonutils.ResultData;
import com.example.service_cms.entity.CrmBanner;
import com.example.service_cms.service.CrmBannerService;
import io.swagger.annotations.ApiOperation;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-05-30
 */
@RestController
@RequestMapping("/educms/bannerfront")
@MapperScan("com.example.service_cms.mapper")
public class BannerFrontController {
    @Autowired
    private CrmBannerService bannerService;

    @ApiOperation(value = "获取首页banner")
    @GetMapping("getAllBanner")
    @Cacheable(value = "BannerInfo",key = "'AllBanner'")
    public ResultData index() {
        List<CrmBanner> list = bannerService.selectIndexList();
        return ResultData.ok().data("list", list);
    }
}

